package com.oriental.manage.controller.specially;

import com.oriental.manage.core.paging.Pagination;
import com.oriental.manage.service.specially.BlackListService;
import com.oriental.riskfront.api.model.response.ResponseDTO;
import com.oriental.riskfront.api.model.specially.ResponseModel;
import com.oriental.riskfront.api.model.specially.TBlackListDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by sTrAnGeR on 2017/4/25.
 */

@Slf4j
@Controller
@RequestMapping("riskInfo/blackListQuery")
public class BlackListController {

    @Autowired
    private BlackListService blackListService;

    @RequestMapping("/init")
    public String init(){
        return "specially/searchBlackList";
    }

    @RequestMapping("/warningInit")
    public String warningInit(){
        return "specially/searchWarningList";
    }

    @RequestMapping("/toDetail")
    public String toDetail(){
        return "specially/searchBlackListDetail";
    }

    @RequestMapping("/search")
    @ResponseBody
    public ResponseModel<Pagination<TBlackListDto>> search(Pagination<TBlackListDto> pagination, TBlackListDto tBlackListDto){
        ResponseModel<Pagination<TBlackListDto>> responseModel = new ResponseModel<Pagination<TBlackListDto>>();
        try{
            blackListService.queryTBlackList(pagination,tBlackListDto,responseModel);
            log.info("查询黑名单风险提示名单信息:{},{}", tBlackListDto, pagination);
            responseModel.setSuccess(true);
            responseModel.setResult(pagination);
        }catch (Exception e){
            log.error("查询黑名单风险提示名单信息失败", e);
        }
        return responseModel;
    }

}
